|
|
|
|
|
|
|
Every item for a resource in your resource definition file has an associated index value. The value 1 is reserved for your application's icon. The DOS-based resource compiler compiles the RC file into a RES file. For the sake of simplicity, consider adding only string text to the label controls. |
|
|
|
|
|
|
|
|
To keep your example simple, add two labels to the left of the two text boxes. Keep the default name, Label1, and let them both be in the same control array. Now create the simple resource file that will contain only the captions for the two labels. Using Notepad or WordPad, enter the following in the blank text document: |
|
|
|
|
|
|
|
|
#define sNAME 2
#define sURL 3
STRINGTABLE DISCARDABLE
BEGIN
sNAME, "Samsona Software"
sURL, "http://www.samsona.com'' END |
|
|
|
|
|
|
|
|
The #define statement is a compiler directive that defines constants and variables to be used. STRINGTABLE DISCARDABLE means that the table of string values can be discarded from memory when no longer in use. Save the file as memento.rc. At an MS-DOS command prompt, enter the following: |
|
|
|
|
|
|
|
|
RC /r /fo memento.res memento.rc |
|
|
|
|
|
|
|
|
If you have the Memento project files in a folder that is different from the Visual Basic folder, specify the full path name of the resource definition file. |
|
|
|
|
|
|
|
|
Add the resource file to the Visual Basic project. Choose Project ¦ Add File from the Visual Basic menu. You will see the Add File dialog box. Browse to the folder that contains the resource file, memento.res. Choose the file and click OK. |
|
|
|
|
|
|
|
|
Create a class called, fittingly, ResourceFile. Add the following methods to the ResourceFile class: |
|
|
|
|
|
|
|
|
Public Function loadString(argIndex As Integer)
Public Function loadPicture(argIndex As Integer, argFormat As Byte)
Public Function loadIcon(argIndex As Integer)
Public Function loadData(argIndex As Integer, argFormat As Byte) |
|
|
|
|
|